package com.stox.charting.ui.swing.presenter.delegate.composer;

import com.stox.charting.ui.swing.model.Axis;
import com.stox.charting.ui.swing.view.ChartView;

public class ChartViewComposer {

	private ChartComposer chartComposer;
	
	public void compose(ChartView view){ 
		if(view != null && view.getChartCount() > 0){
			if(!view.getAxes().isEmpty()){
				for(Axis axis : view.getAxes()){
					view.add(axis, axis.getBorderLayoutConstraints());
				}
				view.revalidate();
			}
			for(int i = 0; i < view.getChartCount(); i ++){
				view.getContentPane().add(view.getChart(i), new Integer(view.getChartCount() - i));
				chartComposer.compose(view.getChart(i));
			}
		}
	}

	public ChartComposer getChartComposer() {
		return chartComposer;
	}

	public void setChartComposer(ChartComposer chartComposer) {
		this.chartComposer = chartComposer;
	}
	
	
}
